package inner_class.member_inner_class;

/**
 * @Package: inner_class.member_inner_class
 * @ClassName: MemberInnerClass
 * @Author: x2606
 * @CreateTime: 2022/3/12 16:32
 * @Description: 成员内部类
 */

public class MemberInnerClass {
    public static void main(String[] args) {
        Outer outer = new Outer();
        outer.say();
    }
}

class Outer{
    private int n = 100;

    class Inner{
        //可以访问外部类的所有成员
        public void show(){
            System.out.println(n);
        }
    }

    public void say(){
        Inner inner = new Inner();
        inner.show();
    }
}